package ngat.oss.simulation;

/** A proposal account.*/
public class Account {

    private double allocated;

    private double used;

    /** Create an Account with specified allocation and used amounts.*/
    public Account(double allocated, double used) {
	this.allocated = allocated;
	this.used = used;
    }

    public void credit(double amount) {
	allocated += amount;
	//	System.err.println("Credit account: "+amount);
    }

    public void debit(double amount) {
	used += amount;	
	//System.err.println("Debit account: "+amount);
    }

    public double getAllocated() { return allocated; }

    public double getUsed() { return used; }

    public double getBalance() { return allocated - used; }

    public double getFraction() { return used/allocated; }

    public String toString() {
	return "[Alloc="+allocated+", Used="+used+", Bal="+getBalance()+", FracUsed="+getFraction()+"]";
    }
	
}
